package com.longxi.tianjintianbao.greedao.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.longxi.tianjintianbao.greedao.dao.DaoSession;
import com.longxi.tianjintianbao.greedao.dao.PatrolContentDao;
import com.longxi.tianjintianbao.greedao.dao.PatrolDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.Date;
import java.util.List;

@Entity
public class Patrol {
    @Id(autoincrement = true)
    public Long id;
    public Long billid;//单据id
    public Long userid;//登录用户内部编码
    public Long iptype;//登录用户所使用的ip类型
    public String name;//检查点名称
    public String address;//检查点地址
    public Long addressid;
    public Date startdate;//开始时间
    public Date enddate;//结束时间
    public String executor;//执行人
    public String inspecttype;
    public String applicant;//0-未完成 在巡检时间段外上传 2-已完成 在巡检时间段上传
    public String state;//0-正常 1-异常
    public String isDraft;//0未巡检 1已巡检未提交 2已巡检已提交
    public String explain;//说明
    public String releasetime;//提交时间
    public String image1;//图片1
    public String image2;//图片2
    @ToMany(referencedJoinProperty = "billid")
    public List<PatrolContent> content;//巡检项目
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1148119580)
    private transient PatrolDao myDao;



    @Generated(hash = 743822884)
    public Patrol() {
    }


    @Generated(hash = 1048045271)
    public Patrol(Long id, Long billid, Long userid, Long iptype, String name, String address,
            Long addressid, Date startdate, Date enddate, String executor, String inspecttype,
            String applicant, String state, String isDraft, String explain, String releasetime,
            String image1, String image2) {
        this.id = id;
        this.billid = billid;
        this.userid = userid;
        this.iptype = iptype;
        this.name = name;
        this.address = address;
        this.addressid = addressid;
        this.startdate = startdate;
        this.enddate = enddate;
        this.executor = executor;
        this.inspecttype = inspecttype;
        this.applicant = applicant;
        this.state = state;
        this.isDraft = isDraft;
        this.explain = explain;
        this.releasetime = releasetime;
        this.image1 = image1;
        this.image2 = image2;
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getBillid() {
        return billid;
    }

    public void setBillid(Long billid) {
        this.billid = billid;
    }

    public Long getUserid() {
        return userid;
    }

    public void setUserid(Long userid) {
        this.userid = userid;
    }

    public Long getIptype() {
        return iptype;
    }

    public void setIptype(Long iptype) {
        this.iptype = iptype;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Long getAddressid() {
        return addressid;
    }

    public void setAddressid(Long addressid) {
        this.addressid = addressid;
    }

    public Date getStartdate() {
        return startdate;
    }

    public void setStartdate(Date startdate) {
        this.startdate = startdate;
    }

    public Date getEnddate() {
        return enddate;
    }

    public void setEnddate(Date enddate) {
        this.enddate = enddate;
    }

    public String getExecutor() {
        return executor;
    }

    public void setExecutor(String executor) {
        this.executor = executor;
    }

    public String getInspecttype() {
        return inspecttype;
    }

    public void setInspecttype(String inspecttype) {
        this.inspecttype = inspecttype;
    }

    public String getApplicant() {
        return applicant;
    }

    public void setApplicant(String applicant) {
        this.applicant = applicant;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getIsDraft() {
        return isDraft;
    }

    public void setIsDraft(String isDraft) {
        this.isDraft = isDraft;
    }

    public String getExplain() {
        return explain;
    }

    public void setExplain(String explain) {
        this.explain = explain;
    }

    public String getReleasetime() {
        return releasetime;
    }

    public void setReleasetime(String releasetime) {
        this.releasetime = releasetime;
    }

    public String getImage1() {
        return image1;
    }

    public void setImage1(String image1) {
        this.image1 = image1;
    }

    public String getImage2() {
        return image2;
    }

    public void setImage2(String image2) {
        this.image2 = image2;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1862493882)
    public List<PatrolContent> getContent() {
        if (content == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            PatrolContentDao targetDao = daoSession.getPatrolContentDao();
            List<PatrolContent> contentNew = targetDao._queryPatrol_Content(id);
            synchronized (this) {
                if (content == null) {
                    content = contentNew;
                }
            }
        }
        return content;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1976062732)
    public synchronized void resetContent() {
        content = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2083577010)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPatrolDao() : null;
    }

}
